import os
import shutil


# 解析之后删除文件


def del_file(path):
    if not os.listdir(path):
        print('目录为空！')
    else:
        for i in os.listdir(path):
            path_file = os.path.join(path, i)  # 取文件绝对路径
            if os.path.isfile(path_file):
                os.system(f"attrib -r {path_file}")
                os.remove(path_file)
            else:
                del_file(path_file)
                shutil.rmtree(path_file)


if __name__ == '__main__':
    path = r'../../java'
    del_file(path)
